import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/drama_home_entity.dart';

DramaHomeEntity $DramaHomeEntityFromJson(Map<String, dynamic> json) {
  final DramaHomeEntity dramaHomeEntity = DramaHomeEntity();
  final int? dramaId = jsonConvert.convert<int>(json['drama_id']);
  if (dramaId != null) {
    dramaHomeEntity.dramaId = dramaId;
  }
  final String? dramaName = jsonConvert.convert<String>(json['drama_name']);
  if (dramaName != null) {
    dramaHomeEntity.dramaName = dramaName;
  }
  final String? bookImg = jsonConvert.convert<String>(json['book_img']);
  if (bookImg != null) {
    dramaHomeEntity.bookImg = bookImg;
  }
  final int? recSort = jsonConvert.convert<int>(json['rec_sort']);
  if (recSort != null) {
    dramaHomeEntity.recSort = recSort;
  }
  final int? ctime = jsonConvert.convert<int>(json['ctime']);
  if (ctime != null) {
    dramaHomeEntity.ctime = ctime;
  }
  final int? dramaFrom = jsonConvert.convert<int>(json['drama_from']);
  if (dramaFrom != null) {
    dramaHomeEntity.dramaFrom = dramaFrom;
  }
  final int? dramaAllEp = jsonConvert.convert<int>(json['drama_all_ep']);
  if (dramaAllEp != null) {
    dramaHomeEntity.dramaAllEp = dramaAllEp;
  }
  final int? dramaUpdateEp = jsonConvert.convert<int>(json['drama_update_ep']);
  if (dramaUpdateEp != null) {
    dramaHomeEntity.dramaUpdateEp = dramaUpdateEp;
  }
  final String? dramaDesc = jsonConvert.convert<String>(json['drama_desc']);
  if (dramaDesc != null) {
    dramaHomeEntity.dramaDesc = dramaDesc;
  }
  final String? dramaTypeName = jsonConvert.convert<String>(
      json['drama_type_name']);
  if (dramaTypeName != null) {
    dramaHomeEntity.dramaTypeName = dramaTypeName;
  }
  return dramaHomeEntity;
}

Map<String, dynamic> $DramaHomeEntityToJson(DramaHomeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['drama_id'] = entity.dramaId;
  data['drama_name'] = entity.dramaName;
  data['book_img'] = entity.bookImg;
  data['rec_sort'] = entity.recSort;
  data['ctime'] = entity.ctime;
  data['drama_from'] = entity.dramaFrom;
  data['drama_all_ep'] = entity.dramaAllEp;
  data['drama_update_ep'] = entity.dramaUpdateEp;
  data['drama_desc'] = entity.dramaDesc;
  data['drama_type_name'] = entity.dramaTypeName;
  return data;
}

extension DramaHomeEntityExtension on DramaHomeEntity {
  DramaHomeEntity copyWith({
    int? dramaId,
    String? dramaName,
    String? bookImg,
    int? recSort,
    int? ctime,
    int? dramaFrom,
    int? dramaAllEp,
    int? dramaUpdateEp,
    String? dramaDesc,
    String? dramaTypeName,
  }) {
    return DramaHomeEntity()
      ..dramaId = dramaId ?? this.dramaId
      ..dramaName = dramaName ?? this.dramaName
      ..bookImg = bookImg ?? this.bookImg
      ..recSort = recSort ?? this.recSort
      ..ctime = ctime ?? this.ctime
      ..dramaFrom = dramaFrom ?? this.dramaFrom
      ..dramaAllEp = dramaAllEp ?? this.dramaAllEp
      ..dramaUpdateEp = dramaUpdateEp ?? this.dramaUpdateEp
      ..dramaDesc = dramaDesc ?? this.dramaDesc
      ..dramaTypeName = dramaTypeName ?? this.dramaTypeName;
  }
}